package fristphase.day02;

import java.util.Scanner;

public class 猜数字小游戏DoWhile {
    public static void main(String[] args) {
        int num = (int)(Math.random()*1000+1);
        Scanner scanner = new Scanner(System.in);
        System.out.println(num);
        int guess = scanner.nextInt();
        int a = 0;
        do{
            if(guess>num){
                System.out.println("太大了");
            }else if(guess<num) {
                System.out.println("太小了");
            }else {
                System.out.println("你猜对了");
                break;
            }
            guess = scanner.nextInt();
            a++;
        }while (guess!=num);
        System.out.println(a);
    }
}
